package cn.jbolt.ai.demo.controller;

import cn.jbolt.ai.demo.service.impl.FunctionCallTestService;
import cn.jbolt.ai.resource.function.anno.FunctionParam;
import cn.jbolt.ai.resource.function.anno.FunctionResource;
import cn.jbolt.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ResponseBody
@RequestMapping("/functionCallTest")
@Tag(name = "FunctionCall测试的controller")
public class FunctionCallTestController {

    @Autowired
    private FunctionCallTestService FunctionCallTestService;

    @Operation(summary = "测试functionCall的反射调用", description = "测试functionCall的反射调用")
    @GetMapping("/testFunctionCallReflective")
    public Result testFunctionCallReflective(String packageAndClassName,  String methodName, String param1, String param2){

        return FunctionCallTestService.testFunctionCallReflective(packageAndClassName, methodName, param1, param2);
    }


    @Operation(summary = "公司招聘的functionCall", description = "招聘的functionCall")
    @FunctionResource(desc = "公司招聘,根据查询返回招聘的相关信息，包括部门名称,工作岗位等信息")
    @GetMapping("/inviteJob")
    public Result inviteJob(@FunctionParam(required = true, description = "部门名称") String departmentName,
                            @FunctionParam(required = true, description = "工作岗位名称") String JobName){

        return FunctionCallTestService.inviteJob(departmentName, JobName);
    }
    @Operation(summary = "我要找工作的functionCall", description = "我要找工作的functionCall")
    @FunctionResource(desc = "我要找工作,根据查询返回找工作的相关信息，包括所在地区,工作岗位等信息")
    @GetMapping("/JobSearch")
    public Result JobSearch(@FunctionParam(required = true, description = "地区名称") String areaName,
                            @FunctionParam(required = true, description = "工作岗位名称") String JobName){

        return FunctionCallTestService.JobSearch(areaName, JobName);
    }
    @Operation(summary = "根据用户姓名查询订单记录", description = "根据用户姓名查询订单记录")
    @FunctionResource(desc = "查询订单记录,根据某些关键字查询订单相关的信息，包括用户的用户名等信息")
    @GetMapping("/searchOrder")
    public Result searchOrder(@FunctionParam(required = false, description = "用户昵称",defaultValue = "") String userName){

        return FunctionCallTestService.searchOrder(userName);
    }

}
